public class Test {

    public static void main(String[] args) {

        Aminal a = new Aminal() {
            @Override
            public void swim() {
                System.out.println("小狗游泳的很快");
            }
        };

        Swimming(a);

//        Swimming(new Aminal(){
//            @Override
//            public void swim() {
//                System.out.println("小狗游泳的很快");
//            }
//        });
    }


    public static void Swimming(Aminal aminal) {
        aminal.swim();
    }
}

abstract class  Aminal{
   public abstract void  swim();
}